﻿
using System;
using Game2DFramework;
using MechGame.Game.Leveling;
using MechGame.Utility;

namespace MechGame.Game
{
    class GameCursor : Cursor
    {
        private Level _level;

        public GameCursor(Game2D game) : base(game)
        {
            Game.GlobalObjectChanged += OnGlobalObjectChanged;
        }

        private void OnGlobalObjectChanged(string name, GameObject oldValue, GameObject newValue)
        {
            if (name == "Level") _level = (Level)newValue;
        }

        public override void Update()
        {
            base.Update();
            if (_level.CurrentyOnDestroyable(WorldPosition)) SetType(CursorType.Targeting);
        }
    }
}
